import store from '@/store'
import request from '@/utils/request'

// 登录接口
export const login = (data) => {
  return request({
    method: 'POST',
    url: '/front/user/login',
    // data应该是字符串形式：'a=10&b=20&c=20'
    // 为什么用反单引号，因为里边值是变量
    // data: `phone=${this.loginForm.phone}&password=${this.loginForm.password}`
    data: `phone=${data.phone}&password=${data.password}`
  })
}
// 获取用户信息接口
export const getUserInfo = () => {
  return request({
    method: 'GET',
    url: '/front/user/getInfo',
    // 添加头部信息
    headers: {
      Authorization: store.state.tokenInfo?.access_token
    }
  })
}
